-- This file is part of the Fantasy Grounds Open Foundation Ruleset project. 
-- For the latest information, see http://www.fantasygrounds.com/
--
-- Copyright 2008 SmiteWorks Ltd.
--
-- This file is provided under the Open Game License version 1.0a
-- Refer to the license.html file for the full license text
--
-- All producers of work derived from this material are advised to
-- familiarize themselves with the license, and to take special
-- care in providing the definition of Product Identity (as specified
-- by the OGL) in their products.
--
-- All material submitted to the Open Foundation Ruleset project must
-- contain this notice in a manner applicable to the source file type.


skillstatenode = nil;

function update()
	if activesetnode then
		if window.isInSet(activesetnode.getValue()) then
			setIcon("indicator_checkon");
		else
			setIcon("indicator_checkoff");
		end
	end
end

function toggle()
	if activesetnode then
		local newstate = not window.isInSet(activesetnode.getValue());
		window.setInSet(activesetnode.getValue(), newstate);
	end
end

function isClassSkill()
	if activesetnode and window.isInSet(activesetnode.getValue()) then
		return true;
	end

	return false;
end

function onClickDown(button, x, y)
	toggle();
end

function onInit()
	-- Set selection
	activesetnode = window.windowlist.window.getDatabaseNode().createChild("activeskillset", "number");
end
